package com.aistar.controller;

import com.aistar.service.CompanyService;
import com.aistar.util.ServerResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

@Controller
public class ConpanyController {
    @Autowired
    private CompanyService companyService;
    @RequestMapping("company/{companyId}")
    @ResponseBody
    public ModelAndView getById(@PathVariable("companyId") Integer id){
        ModelAndView mav = new ModelAndView();
        ServerResponse serverResponse = companyService.getById(id);
        mav.addObject("company",serverResponse.getData());
        mav.setViewName("/company/company_detail");
       return mav;
    }

}
